/**
 * @file planner.h
 * @author BadFatCat0919 (543015378@qq.com)
 * @brief 方案规划器类
 */

#ifndef __PLANNER_H__
#define __PLANNER_H__

#include "Dispatcher.h"
#include "Bench.h"
#include "def.h"

/**
 * @brief 方案规划器
 */
class Planner {
public:
    struct Plan {
        bool valid = false; // 方案是否有效
        bool isNoTime = false; // 是否没有时间了
        int type = 0; // 方案的货物类型
        int robot = -1; // 分配的机器人
        int buy = -1; // 购买工作台
        int sell = -1; // 出售工作台
        double earningRate = 0; // 收益路程比
        Plan() = default;
        Plan(int type, int robot, int buy, int sell, int frames, double earning):
            valid(true), type(type), robot(robot), buy(buy), sell(sell), earningRate(earning / frames) {}
    };

private:
    static Plan getPlan(Dispatcher *dispatcher, Bench benchs[], int remainFrames);

public:
    static void loop(Dispatcher dispatchers[], Bench benchs[], int remainFrames);
};

#endif // __PLANNER_H__
